package com.yjd.comm.recharge.util;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import com.yjd.comm.recharge.model.VolumeFinancialModel;

/**
 * <b>description</b>：理财金工具类 <br>
 * <b>time</b>：2015-1-18下午3:36:05 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class VFMUtil {
	/**
	 * 理财金排序器
	 */
	private static Comparator<VolumeFinancialModel> vfmCpt = new Comparator<VolumeFinancialModel>() {
		@Override
		public int compare(VolumeFinancialModel o1, VolumeFinancialModel o2) {
			if (o1.getEndtime() != null && o2.getEndtime() != null) {
				int result = o1.getEndtime().compareTo(o2.getEndtime());
				if(result==0){
					result = o1.getVolume_id().compareTo(o2.getVolume_id());
				}
				return result;
			}
			return 0;
		}
	};

	/**
	 * 理财金按升序
	 * 
	 * @param list
	 */
	public static void ascSort(List<VolumeFinancialModel> list) {
		if (list != null) {
			Collections.sort(list, vfmCpt);
		}
	}
}
